<?php
/* @var $this SiteController */

$this->pageTitle=Yii::app()->name;
$listPenjualan = Yii::app()->db->createCommand()
	->select('sum(dp.jumlahbrg_detod) as jmlbarang, count(pm.id_user) as jmluser')
	->from('detail_pemesanan dp')
	->join('pemesanan pm', 'dp.id_pemesanan=pm.id_pemesanan')
	->group('pm.tanggal_pemesanan')
	->where('pm.status>=1')
	->order('tanggal_pemesanan desc')
	->limit(100)
	->queryAll();
	
$titleModel=Konfigurasi::model()->findByPk(0);	
?>

<h1>Selamat Datang <i> <?php echo $titleModel->site_title; ?></i></h1>

	<div class="section">
		<div class="box">
			<div class="title">
				<h2>Statistics</h2>
				<span class="hide"></span>
			</div>
			<div class="content">
				<div class="caption">Statistics for August</div> 
				<table class="statics" style="width : 100%;"> 
					<thead> 
						<tr> 
							<th></th> 
							<th style="color : #00366f;">Jumlah Penjualan Barang</th> 
							<th style="color : #006ba0;">Jumlah User</th> 
						</tr> 
					</thead> 
					<tbody> 
						<?php
							for($i=0;$i<count($listPenjualan);$i++)
							{
								echo "<tr>";
									echo "<th></th><td>".$listPenjualan[$i]['jmlbarang']."</td><td>".$listPenjualan[$i]['jmluser']."</td>";
								echo "</tr>";
							}
						// <tr> 
							// <th>1</th><td>256</td><td>1207</td> 
						// </tr> 
						?>
					
						
					</tbody> 
				</table>
			</div>
		</div>
	</div>
